home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / misc / emu / arosdev.lha / AROS / rom / utility / packbooltags.c < prev    next >
C/C++ Source or Header  |  1997-01-27  |  3KB  |  109 lines

  1. /*
  2.     $Id: packbooltags.c,v 1.6 1997/01/27 00:32:32 ldp Exp $
  3.     $Log: packbooltags.c,v $
  4.     Revision 1.6  1997/01/27 00:32:32  ldp
  5.     Polish
  6.  
  7.     Revision 1.5  1996/11/21 16:41:05  aros
  8.     Includes must start in the first column
  9.  
  10.     No includes may be used in the SEE ALSO field
  11.  
  12.     Revision 1.4  1996/10/24 22:51:46  aros
  13.     Use proper Amiga datatypes (eg: ULONG not unsigned long)
  14.  
  15.     Revision 1.3  1996/10/24 15:51:36  aros
  16.     Use the official AROS macros over the __AROS versions.
  17.  
  18.     Revision 1.2  1996/10/23 14:08:59  aros
  19.     Formatted
  20.  
  21.     Added parens to all assignments which are used truth expressions
  22.  
  23.     Revision 1.1  1996/10/22 04:46:00  aros
  24.     Some more utility.library functions.
  25.  
  26.     Desc:
  27.     Lang: english
  28. */
  29. #include "utility_intern.h"
  30.  
  31. /*****************************************************************************
  32.  
  33.     NAME */
  34. #include <utility/tagitem.h>
  35. #include <proto/utility.h>
  36.  
  37.     AROS_LH3(ULONG, PackBoolTags,
  38.  
  39. /*  SYNOPSIS */
  40.     AROS_LHA(ULONG           , initialFlags, D0),
  41.     AROS_LHA(struct TagItem *, tagList, A0),
  42.     AROS_LHA(struct TagItem *, boolMap, A1),
  43.  
  44. /*  LOCATION */
  45.     struct UtilityBase *, UtilityBase, 7, Utility)
  46.  
  47. /*  FUNCTION
  48.     Scans through the list tagList to find the tags which are contained
  49.     in the list boolMap which are then converted to a bit-flag
  50.     representation as defined in boolMap.
  51.  
  52.     If the value of the Tag's data is 0, then the boolean value of the
  53.     tag is defined as false, otherwise it is true.
  54.  
  55.     INPUTS
  56.     initialFlags -    an initial set of bit-flags which will be changed
  57.             by this function.
  58.  
  59.     tagList      -    A TagItem list which contains some tags which are
  60.             defined as boolean by having a corresponding tag
  61.             in boolMap. The boolean value of tag->ti_Data
  62.             determines whether the bits in the flag are
  63.             TRUE or FALSE.
  64.  
  65.     boolMap      -    A TagItem list containing a series of tags which
  66.             are to be considered Boolean.
  67.  
  68.     RESULT
  69.     flags         -    The value of initialFlags modified by the values
  70.             of the boolean tags defined in boolMap.
  71.  
  72.     NOTES
  73.     If there is more than one Tag in tagList of a single type. The
  74.     last of these tags will determine the value of that bit-flag.
  75.  
  76.     EXAMPLE
  77.  
  78.     BUGS
  79.  
  80.     SEE ALSO
  81.     GetTagData(), FindTagItem(), NextTagItem()
  82.  
  83.     INTERNALS
  84.  
  85.     HISTORY
  86.     29-10-95    digulla automatically created from
  87.                 utility_lib.fd and clib/utility_protos.h
  88.     18-08-96    iaint   Created. But still needs some testing.
  89.  
  90. *****************************************************************************/
  91. {
  92.     AROS_LIBFUNC_INIT
  93.     struct TagItem *current, *found;
  94.  
  95.     while ((current = NextTagItem (&tagList)))
  96.     {
  97.     if ((found = FindTagItem (current->ti_Tag, boolMap)))
  98.     {
  99.         if (current->ti_Data == 0)
  100.         initialFlags &= ~(found->ti_Data);
  101.         else
  102.         initialFlags |= found->ti_Data;
  103.     }
  104.     }
  105.  
  106.     return initialFlags;
  107.     AROS_LIBFUNC_EXIT
  108. } /* PackBoolTags */
  109.